﻿CREATE TABLE [dbo].[AccountBalance] (
    [Id]        UNIQUEIDENTIFIER NOT NULL,
    [AccountId] INT              NOT NULL,
    [Currency]  CHAR (3)         NOT NULL,
    [Balance]   DECIMAL (18)     NOT NULL,
    CONSTRAINT [PK_SubAccount] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_AccountBalance_Account] FOREIGN KEY ([AccountId]) REFERENCES [dbo].[Account] ([Id])
);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_AccountBalance]
    ON [dbo].[AccountBalance]([AccountId] ASC, [Currency] ASC);

